<?php
require_once dirname(__FILE__) . '/../includes/common.inc.php';
require_once dirname(__FILE__) . '/../includes/pdoorm.inc.php';

header('Content-Type: text/plain');
die;
$sql="
    insert into ns_v1purchasenote
    SELECT a.*,IFNULL(b.oid_a,0) AS purchaseitem_id FROM ns_purchasenote AS a LEFT JOIN ns__ez_relation_purchaseitem_purchasenote AS b
ON a.e_oid = b.oid_b
";

sql_execute($sql);
